<?php
/**
 * Edit page content
 *
 * @author     Mario Schillermann <info@rockit-flash.com>
 * @encoding   UTF-8 äöüßÖÄÜ
 * @copyright  © 2011 Mario Schillermann (info@rockit-flash.com)
 * @license    GNU GPL v2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @uses       Zend_Controller_Action
 * @package    Minipage
 * @subpackage Controller
 * @todo
 */
class Minipage_AppController extends Zend_Controller_Action
{
    /**
     * Initialize object
     * 
     * @return void
     */
    public function init()
    {
        $this->view->headTitle('Minipage bearbeiten');
        if($this->_request->getPost('form')) {
            $this->_forward('save');
        }
    }
    /**
     * Show page content
     *
     * @return void
     */
    public function indexAction()
    {  //$this->_forward("index", "info");
        $path = realpath(APPLICATION_PATH . '/../home/default/minipage');

        if ($path === FALSE) {
            throw new Exception('Home path not found!');
        }
        /** Get header data */
        $head = new Zend_Config_Ini($path . '/index.ini', 'head');
        $this->view->title = $head->title;
        $this->view->keywords = $head->meta->keywords;
        $this->view->description = $head->meta->description;
        $this->view->author = $head->meta->author;
        /** Get page content */
        $this->view->content = file_get_contents($path . '/index.phtml');
    }
    /**
     * Save new page content
     *
     * @return void
     */
    public function saveAction()
    {
        $request = $this->_request->getPost('form');
        Minipage_Model_Page::save($request);
    }
}